package com.julyup.face.service;

import com.julyup.face.entity.User;
import com.julyup.face.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: zhenzhong.wang@honeywell.com
 * @Date: 2019/3/22 3:47 PM
 */
@Service
public class UserService {
  @Autowired
  UserRepository userRep;

  public void save(User user) {
    userRep.save(user);
  }

  public User findOne(Long id) {
    return userRep.getOne(id);
  }

  public User findByUsername(String username) {
    User user = userRep.findByUsername(username);
    return user;
  }

  public void delete(Long id) {
    userRep.deleteById(id);
  }
}